package com.example.service.impl;

import com.example.entity.Unit;
import com.example.mapper.UnitMapper;
import com.example.service.UnitService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.CacheConfig;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Author:tjf
 * @Description:
 */
@CacheConfig(cacheNames = "com.example.service.impl.UnitServiceImpl")
@Service
public class UnitServiceImpl implements UnitService {
    @Autowired
    private UnitMapper unitMapper;

    /**
     * 查询所有物品规格单位的业务方法
     * @return
     */
    @Cacheable(key = "'unit:all'")
    @Override
    public List<Unit> queryAllUnit() {
        return unitMapper.selectAllUnit();
    }
}
